// 直接在Arduino IDE选择“文件”→“示例”→Wire→master_writer可以打开该文件
#include <Wire.h>
#define SDA 21
#define SCL 22
void setup() {
  Wire.setPins(SDA, SCL);
  Wire.begin();


  Serial.begin(115200);
  Serial.println("Hello world!");

  int count = 0;

  for (byte i = 8; i < 120; i++) {
    Wire.beginTransmission(i);
    if (Wire.endTransmission() == 0) {
      Serial.print("Found I2C Device: ");
      Serial.print(" (0x");
      Serial.print(i, HEX);
      Serial.println(")");
      count++;
      delay(1);
    }
  }
  Serial.println("Find Stop");
}

byte x = 0;  // 定义一个byte变量以便串口调试
void loop() {
  Wire.beginTransmission(8);
  Wire.write("x is ");     // 发送5B的字符串
  Wire.write(x);           // 发送1B的数据
  Wire.endTransmission();  // 结束传送

  //Serial.println(x);
  x++;
  delay(500);
}
